package com.thti.mecool.client.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.threeti.mecool.mobile.interfaces.dto.MemoDto;
import com.thti.mecool.client.base.BaseActivity;
import com.thti.mecool.client.base.Cache;
import com.thti.mecool.client.widget.Toolbar;

public class WorkMemoContentDetailActivity extends BaseActivity {
	TextView time,shop,content,mecool_workmemo_item_detail_shop_choice,mecool_workmemo_item_detail_shop;
	EditText edit_content;
	LinearLayout mecool_workmemo_detail_shop,mecool_workmemo_detail_shop_choice;
	String curItemCode;
	String curCommId;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		this.noTitle();
		setContentView(R.layout.mecool_workmemo_item_detail);
		Cache.add(this);
		initToolbar();
		Intent intent=getIntent();
		curItemCode=intent.getStringExtra("curItemCode");
		curCommId=intent.getStringExtra("editcommId");
		MemoDto CurMemoItem=(MemoDto) intent.getSerializableExtra("item");
		time=(TextView)findViewById(R.id.mecool_workmemo_item_detail_time);
		shop=(TextView)findViewById(R.id.mecool_workmemo_item_detail_shop);
		content=(TextView)findViewById(R.id.mecool_workmemo_item_detail_content);
		edit_content=(EditText)findViewById(R.id.mecool_workmemo_item_detail_content_edit);
		time.setText(CurMemoItem.getRecordDate());
		shop.setText(CurMemoItem.getChannelName());
		content.setText(CurMemoItem.getContent());
		mecool_workmemo_detail_shop=(LinearLayout)findViewById(R.id.mecool_workmemo_detail_shop);
		mecool_workmemo_detail_shop_choice=(LinearLayout)findViewById(R.id.mecool_workmemo_detail_shop_choice);
		mecool_workmemo_item_detail_shop_choice=(TextView)findViewById(R.id.mecool_workmemo_item_detail_shop_choice);
	}
	
	public void initToolbar(){
		Toolbar toolbar=new Toolbar(this);
		toolbar.setToolbarCentreText("备忘内容");
		Toolbar.left_btn.setOnClickListener(ToolbarBtnListener);
		Toolbar.right_btn.setOnClickListener(ToolbarBtnListener);
		Toolbar.left_btn.setImageResource(R.drawable.mecool_go_back);
		Toolbar.right_btn.setImageResource(R.drawable.mecool_add_work_memo_add);
	}
	private OnClickListener ToolbarBtnListener=new OnClickListener(){
		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.mecool_toolbar_rightbtn:
				Intent i=new Intent(WorkMemoContentDetailActivity.this,AddWorkMemoActivity.class); 
				i.putExtra("WorkMemoEdit", true);
				i.putExtra("workmemoshop", shop.getText().toString());
				i.putExtra("workmemocontent", content.getText().toString());
				i.putExtra("storeCode", curItemCode);
				i.putExtra("curCommId", curCommId);
				startActivity(i);
				finish();
				break;
			default:
				setResult(10);
				finish();
				break;
			}
		}};
		
}
